package com.ftg.learn.controller;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.alibaba.nacos.api.config.annotation.NacosValue;
import com.ftg.learn.service.DemoService;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * 数据提供者测试方法
 *
 * @author 布衣
 */
@RestController
@RefreshScope
public class DemoController {

//    //系统 存储到配置中心当中，可以人为干预
//    @Value("${demo.sysName}")
//    private String sysName;

    @Resource
    private DemoService demoService;

    @GetMapping("/provider-data")
    public String getData() {
        String s = demoService.testSentinel();
        return "provider-data"  + s;
    }

    @GetMapping("/provider-data/{name}")
    public String getDataByName(@PathVariable("name") String name) {
        return "provider-data : 9003" + name;
    }

}
